/**
 * 
 */
 function setCartAndCategory()
 {
	var cart = $("#cart");
	var category = $("#category");
	var topMargin = 20;
	var oldTop = $("#food_panel").offset().top;
	var windowScrollTop = $(window).scrollTop();
	var relativeTop = windowScrollTop-oldTop;
	if(relativeTop<0)
	{
		cart.removeClass("cart_fixed");
		cart.addClass("cart_original");
		cart.css("left","");
		category.removeClass("category_fixed");
		category.addClass("category_original");
		category.css("left","");
	}
	else {
		var cart_left = cart.offset().left;
		//减去left margin
		var category_left = category.offset().left-10;
		cart.removeClass("cart_original");
		cart.addClass("cart_fixed");
		cart.css("left",cart_left);
		category.removeClass("category_original");
		category.addClass("category_fixed");
		category.css("left",category_left);
	}
 }

  
 $(document).ready(function(e) {
	var cart = $("#cart");
	var category = $("#category");
	category.addClass("category_original");
	cart.addClass("cart_original");

	didScroll = true;
	$(window).scroll(function() {
		setCartAndCategory();	
	});
});